<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="./common/base.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户中心_约导游</title>
<!--css-->
<link rel="stylesheet" type="text/css" href="css/wutongstyle.css">
</head>
<body>
<!--head begin-->
<%@ include  file="./common/header.jsp"%>
<!--nav end--> 
<!--content begin-->
<div class="wt_content">
  <dl class="yuedaoyou">
	<%@ include  file="./common/header1.jsp"%><dd>
    <dd>
      <div class="daoyou_info clearfix">
        <div class="xx_box">
          <div class="tainfobox yonghu">
            <h3 id="tuan"><i class="i_co"></i>申请带团</h3>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="biaodan">
              <tr>
                <td class="title">发团标题：</td>
                <td id="titleId"></td>
              </tr>
              <tr>
                <td class="title">出发时间：</td>
                <td id="startTimeId" ></td>
              </tr>
              <tr>
                <td class="title">出发地点：</td>
                <td id="sourcecityId" ></td>
              </tr>
               <tr>
                <td class="title">目的地：</td>
                <td id="targetcityId" ></td>
              </tr>
              <tr>
                <td class="title">是否出境：</td>
                <td id="isoutboundId" ></td>
              </tr>
             
              <tr>
                <td class="title">总天数：</td>
                <td id="daysId" ></td>
              </tr>
              <tr>
                <td class="title">导服：</td>
                <td id="guidecostId" ></td>
              </tr>
              <tr class="red">
                <td class="title">发团人：</td>
                <td id="fatuanInfoId"></td>
              </tr>
              <tr>
                <td class="title">旅游行程：</td>
                <td id="tripId" ></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td><button type="button" value="申请带团" onclick="applyTeam()">申请带团</button></td>
              </tr>
            </table>
          </div>
        </div>
        <div class="zp"><img id="headImgId" src="" width="185" height="185" />
          <div class="tel">
            <h4>快捷菜单</h4>
            <ul class="quick">
              <li><a href="dylogin_5.jsp" class="on" >最新发团信息</a></li>
              <li><a href="dylogin_1.jsp" >已申请的团</a></li>
              <li><a href="dylogin_6.jsp" >已确认的团</a></li>
              <li><a href="dylogin_2.jsp">已带队的团</a></li>
              <li><a href="dylogin_7.jsp" >团信息列表</a></li>
              <li><a href="dylogin_3.jsp" >我的资料</a></li>
              <li><a href="dylogin_4.jsp">站内短信列表</a></li>
            </ul>
          </div>
      
        </div>
      </div>
    </dd>
  </dl>
</div>
<!--content end--> 
<!--footer begin-->
<%@ include  file="./common/footer.jsp"%>
<!--footer end-->
</body>
<script type="text/javascript">
var teamId = request("teamId");
$(function(){
	loadLxsTeamDetail(teamId);
	loadLxsDetail();
	$("#headImgId").attr("src",imgDomain+loginUserPhoto);
});

function loadLxsDetail() {
	var objp={};
	 $.ajax({
		  url: '${path}/core/getAccountDetailByTeamId?teamId='+teamId,
		  type: 'POST',
		  timeout: 30000,
		  cache : false,
	      data :objp,
	      async: false,
	      dataType:"json",      
         contentType:"application/json",   
	     // contentType: "application/json; charset=utf-8",
		  success:function(msg){
			  //alert(msg.totalCount)
			  var data = msg.userDetail;
			  var fatuanInfo=data.name;
			  var fatuanInfo1="&nbsp;&nbsp;【<a href=\"lxsinfo.jsp?travelorgId="+data.id+"\">查看该旅行社相关资料</a>】";
			  var fatuanInfo2="&nbsp;&nbsp;【<a href=\"grinfo.jsp?personalId="+data.id+"\">查看网友相关资料</a>】";
			  if(data.licnum!=null && data.licnum!=""){
				  fatuanInfo+="("+data.licnum+")";  
			  }
			  if(data.phone!=null && data.phone!=""){
				  fatuanInfo+="&nbsp;&nbsp;&nbsp;(联系电话："+data.phone+")";  
			  }
			  if(data.userType==0){
				  fatuanInfo+=fatuanInfo1;
			  }else if(data.userType==1) {
				  fatuanInfo+=fatuanInfo2;
			  }
			  
			  $("#fatuanInfoId").html(fatuanInfo);
			//  常州青旅（旅行社资格证：D-1234-028207）（联系电话：0519-88888888）【<a href="lxsinfo.html">查看该旅行社相关资料</a>】
		  },
		   failure:function(msg){
			   alert(eval('('+msg.responseText+')').error_text);
		   		
		   },
		   error:function(msg){
			   alert(eval('('+msg.responseText+')').error_text); 
		   }
	});
}

function loadLxsTeamDetail(id) {
	var objp={};
	 $.ajax({
		  url: '${path}/core/getTravelTeamById?id='+teamId,
		  type: 'POST',
		  timeout: 30000,
		  cache : false,
	      data :objp,
	      async: false,
	      dataType:"json",      
         contentType:"application/json",   
	     // contentType: "application/json; charset=utf-8",
		  success:function(msg){
			  //alert(msg.totalCount)
			  formatLxsTeamDetail(msg.travelTeam);
		  },
		   failure:function(msg){
			   alert(eval('('+msg.responseText+')').error_text);
		   		
		   },
		   error:function(msg){
			   alert(eval('('+msg.responseText+')').error_text); 
		   }
	});
}

function formatLxsTeamDetail(data) {
	$("#titleId").html(data.teamtitle);
	$("#startTimeId").html(data.startTime);
	$("#sourcecityId").html(data.sourcecity);
	$("#targetcityId").html(data.targetcity);
	$("#isoutboundId").html(data.isoutbound==1?"是":"否");
	$("#daysId").html(data.days);
	$("#tripId").html(data.trip);
	$("#guidecostId").html(data.guidecost+"/天");
	
}

function applyTeam(){
	//applyTravelTeamteamId
	var objp={};
	 $.ajax({
		  url: '${path}/core/applyTravelTeam?teamId='+teamId,
		  type: 'POST',
		  timeout: 30000,
		  cache : false,
	      data :objp,
	      async: false,
	      dataType:"json",      
        contentType:"application/json",   
	     // contentType: "application/json; charset=utf-8",
		  success:function(msg){
			  alert("已接受申请");
			 
		  },
		   failure:function(msg){
			   alert(eval('('+msg.responseText+')').error_text);
		   		
		   },
		   error:function(msg){
			   alert(eval('('+msg.responseText+')').error_text); 
		   }
	});
}

</script>
</html>
